package mapper;

import org.apache.ibatis.annotations.*;
import pojo.User;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    //使用注解查询全部用户
    @Select("select * from mybatis.user;")
    List<User> getUserList();
    //limit分页查询
    List<User> getUserLimitList(Map<String,Object> map);
    //注解通过id查询用户
    @Select("select * from mybatis.user where id=#{id};")
    List<User> getUserById(@Param("id") int id);
    //注解增加用户
    @Insert("insert into mybatis.user (id,name,pwd) values (#{userid},#{userName},#{passWord});")
    int addUser(Map<String,Object> map);
    //注解删除用户
    @Delete("delete from user where id=#{id};")
    int deleteUser(String id);
    //注解修改用户
    @Update("update mybatis.user set name=#{name},pwd=#{pwd} where id=#{id};")
    int updateUser(Map<String,Object> map);
}
